package com.zhb.lkd.utils;

/**
 * @author shadow
 */
public class ThreadLocalUtils {
    private static ThreadLocal<Integer> threadLocal=new ThreadLocal<>();
    /**
     * 获取用户id
     *
     * @return
     */
    public static Integer getUserId(){
        return  threadLocal.get() ;
    }

    /**
     * 设置用户id
     * @param userId
     */
    public static void setUserId(Integer userId){
        threadLocal.set(userId);
    }

    /**
     * 清空用户id
     */
    public static void removeUserId(){
        threadLocal.remove();
    }
}
